// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.core.skinnedmodel.animation;

import java.util.function.Consumer;
import zombie.core.skinnedmodel.advancedanimation.AnimBoneWeight;
import zombie.core.skinnedmodel.model.SkinningBone;

public class AnimationBoneWeightBinding extends AnimationBoneBinding {
    private float m_weight = 1.0F;
    private boolean m_includeDescendants = true;

    public AnimationBoneWeightBinding(AnimBoneWeight boneWeight) {
        this(boneWeight.boneName, boneWeight.weight, boneWeight.includeDescendants);
    }

    public AnimationBoneWeightBinding(String boneName, float weight, boolean includeDescendants) {
        super(boneName);
        this.m_weight = weight;
        this.m_includeDescendants = includeDescendants;
    }

    public float getWeight() {
        return this.m_weight;
    }

    public void setWeight(float weight) {
        this.m_weight = weight;
    }

    public boolean getIncludeDescendants() {
        return this.m_includeDescendants;
    }

    public void setIncludeDescendants(boolean set) {
        this.m_includeDescendants = set;
    }

    public void forEachDescendant(Consumer<SkinningBone> consumer) {
        if (this.m_includeDescendants) {
            SkinningBone skinningBone = this.getBone();
            if (skinningBone != null) {
                skinningBone.forEachDescendant(consumer);
            }
        }
    }
}
